package com.example.portlocalforward.sshmanage;

import com.example.portlocalforward.controller.model.PortLocalForwardResponse;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@EqualsAndHashCode
@AllArgsConstructor
@NoArgsConstructor
public class SessionAndPortLocalForward {
    private String host; // 隧道地址
    private int port; // 端口
    private String username; // 用户名
    private int localPort; // 本地端口
    private String remoteHost; // 远程主机
    private int remotePort; // 远程端口

    public static SessionAndPortLocalForward of(PortLocalForwardResponse response) {
        return new SessionAndPortLocalForward(response.getSshTunnelIp(), response.getSshTunnelPort(),
                response.getSshTunnelUsername(), response.getLocalPort(), response.getRemoteHost(),
                response.getRemotePort());
    }
}
